package cn.corgy.Observer;

public class YObserver extends Observer {
    public YObserver(Person person) {
        this.person = person;
        this.person.add(this);
    }

    @Override
    public void update() {
        if (person.getAge() < 50) {
            System.out.println("是年轻人");
        } else {
            System.out.println("不是年轻人");
        }
    }
}
